import { Descriptions, Drawer } from 'antd';
import pageStyles from '@/common/pageLayout.less';
import ScrollBarLayout from '@/components/ScrollBarLayout';
import { useEffect } from 'react';
import { DictionaryRenderFun } from '../../Acommon';

// import MyIcon from '@/components/MyIcon';

/** 查看对比变更详情 */
export const DetailDrawer = ({ openDrawer, dataInfo, onClose }) => {
  useEffect(() => {
    if (dataInfo?.changeType == 0) {
    }
  }, [dataInfo]);
  return (
    <Drawer
      title="对比变更详情"
      className={pageStyles['detailDrawerDes']}
      style={{
        position: 'absolute',
        height: '100%',
        overflow: 'hidden',
      }}
      onClose={onClose}
      open={openDrawer}
      placement="right"
      getContainer={false}
      width={document.body?.clientWidth * 0.45}
      bodyStyle={{ padding: '5px 0' }}
      closable={false}
      destroyOnClose={true}
    >
      <ScrollBarLayout style={{ padding: '5px 10px' }}>
        <Descriptions bordered={true} size="small" column={2} labelStyle={{ width: 190 }}>
          {dataInfo?.changeType == 0 && (
            <>
              <Descriptions.Item span={2} label="资产编号">
                <div>{dataInfo?.assetCode || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原资产名称">
                <div>{dataInfo?.assetName || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更资产名称">
                <div>{dataInfo?.assetNameNew || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原品牌">
                <div>{dataInfo?.brandTypeName || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更品牌">
                <div>{dataInfo?.brandTypeNewName || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原规格型号">
                <div>{dataInfo?.paramsInfo || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更规格型号">
                <div>{dataInfo?.paramsInfoNew || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原计量单位">
                {DictionaryRenderFun({ text: dataInfo?.unitOfMeasurementName, isState: false })}
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更计量单位">
                {DictionaryRenderFun({ text: dataInfo?.unitOfMeasurementNewName, isState: false })}
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原采购组织形式">
                {DictionaryRenderFun({ text: dataInfo?.procureOrgTypeName, isState: false })}
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更采购组织形式">
                {DictionaryRenderFun({ text: dataInfo?.procureOrgTypeNewName, isState: false })}
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原投入使用日期">
                <div>{dataInfo?.operationalDate || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更投入使用日期">
                <div>{dataInfo?.operationalDateNew || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原资产用途">
                {DictionaryRenderFun({ text: dataInfo?.usedTypeName, isState: false })}
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更资产用途">
                {DictionaryRenderFun({ text: dataInfo?.usedTypeNewName, isState: false })}
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原清查编号">
                <div>{dataInfo?.inventoryNumber || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更清查编号">
                <div>{dataInfo?.inventoryNumberNew || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原管理部门">
                <div>{dataInfo?.assetDepartmentName || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更管理部门">
                <div>{dataInfo?.assetNewDepartmentName || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原管理人">
                <div>{dataInfo?.asseterName || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更管理人">
                <div>{dataInfo?.assetNewerName || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原使用部门">
                <div>{dataInfo?.useDepartmentName || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更使用部门">
                <div>{dataInfo?.usNewDepartmentName || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原使用人">
                <div>{dataInfo?.userName || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更使用人">
                <div>{dataInfo?.usNewerName || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原存放区域">
                {DictionaryRenderFun({ text: dataInfo?.locationName, isState: false })}
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更存放区域">
                {DictionaryRenderFun({ text: dataInfo?.locationNewName, isState: false })}
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原存存放地点">
                {DictionaryRenderFun({ text: dataInfo?.locationInfo, isState: false })}
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更存放地点">
                {DictionaryRenderFun({ text: dataInfo?.locationInfoNew, isState: false })}
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原备注">
                <div>{dataInfo?.remark || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更备注">
                <div>{dataInfo?.remarkNew || '--'}</div>
              </Descriptions.Item>
            </>
          )}

          {dataInfo?.changeType == 1 && (
            <>
              <Descriptions.Item span={1} label="资产编号">
                <div>{dataInfo?.assetCode || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="资产名称">
                <div>{dataInfo?.assetName || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原资产原值">
                <div>{dataInfo?.totalValue || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更资产原值">
                <div>{dataInfo?.totalValueNew || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原财政拨款">
                <div>{dataInfo?.fiscalAppropriation || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更财政拨款">
                <div>{dataInfo?.fiscalAppropriationNew || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原非财政拨款">
                {DictionaryRenderFun({ text: dataInfo?.noFiscalAppropriation, isState: false })}
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更非财政拨款">
                {DictionaryRenderFun({ text: dataInfo?.noFiscalAppropriationNew, isState: false })}
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原财务入账状态">
                {DictionaryRenderFun({ text: dataInfo?.entryStateName, isState: false })}
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更财务入账状态">
                {DictionaryRenderFun({ text: dataInfo?.entryStateNewName, isState: false })}
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原记账日期">
                <div>{dataInfo?.entryDate || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更记账日期">
                <div>{dataInfo?.entryDateNew || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原记账凭证号">
                <div>{dataInfo?.entryCode || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更记账凭证号">
                <div>{dataInfo?.entryCodeNew || '--'}</div>
              </Descriptions.Item>
            </>
          )}
          {dataInfo?.changeType == 2 && (
            <>
              <Descriptions.Item span={1} label="资产编号">
                <div>{dataInfo?.assetCode || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="资产名称">
                <div>{dataInfo?.assetName || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原资产分类">
                {DictionaryRenderFun({ text: dataInfo?.assetClassName, isState: false })}
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更资产分类">
                {DictionaryRenderFun({ text: dataInfo?.assetClassNewName, isState: false })}
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原折旧年限（月）">
                <div>{dataInfo?.durableYears || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更折旧年限（月）">
                <div>{dataInfo?.durableYearsNew || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="原单位会计科目">
                <div>{dataInfo?.ledgerAccountName || '--'}</div>
              </Descriptions.Item>
              <Descriptions.Item span={1} label="变更单位会计科目">
                <div>{dataInfo?.ledgerAccountNewName || '--'}</div>
              </Descriptions.Item>
            </>
          )}
        </Descriptions>
      </ScrollBarLayout>
    </Drawer>
  );
};
